home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / Printing / Print Moire < prev    next >
Encoding:
Text File  |  1999-03-04  |  1.4 KB  |  66 lines  |  [TEXT/ToyS]

  1. on run
  2.     set incr to random number from 2 to 9
  3.     set dims to random number from 200 to 500
  4.     set midP to round (dims / 2)
  5.     
  6.     set drawWin to ¬
  7.         display drawing titled ¬
  8.             "Moire 1.0" with dimensions {dims, dims}
  9.     
  10.     -- Set color
  11.     draw into drawWin ¬
  12.         using state {fg color:"991212"} ¬
  13.         
  14.     -- Across the top
  15.     repeat with x from 0 to dims by incr
  16.         draw a line into drawWin ¬
  17.             inside of {midP, midP, x, 0}
  18.     end repeat
  19.     
  20.     -- Set color, refresh
  21.     draw into drawWin ¬
  22.         using state {fg color:"129912"} ¬
  23.         with refresh
  24.     
  25.     -- Down the right
  26.     repeat with y from 0 to dims by incr
  27.         draw a line into drawWin ¬
  28.             inside of {midP, midP, dims, y}
  29.     end repeat
  30.     
  31.     -- Set color, refresh
  32.     draw into drawWin ¬
  33.         using state {fg color:"121299"} ¬
  34.         with refresh
  35.     
  36.     -- Across the bottom
  37.     repeat with x from dims to 0 by -incr
  38.         draw a line into drawWin ¬
  39.             inside of {midP, midP, x, dims}
  40.     end repeat
  41.     
  42.     -- Set color, refresh
  43.     draw into drawWin ¬
  44.         using state {fg color:"999912"} ¬
  45.         with refresh
  46.     
  47.     -- Down the right
  48.     repeat with y from dims to 0 by -incr
  49.         draw a line into drawWin ¬
  50.             inside of {midP, midP, 0, y}
  51.     end repeat
  52.     
  53.     -- Refresh
  54.     draw into drawWin with refresh
  55.     
  56.     -- Print
  57.     set myPic to capture picture from drawWin
  58.     
  59.     -- On an Epson Printer, not setting up causes a memory error (THP
  60.     set pc to printer configuration with user setup
  61.     print picture myPic with printer config pc without scaling
  62.     
  63.     -- Close window    
  64.     display drawing drawWin with disposal
  65. end run
  66.